﻿using System;
using System.Data;
using System.Data.Common;
using System.Text;
using Besture.Common;
using Besture.Model;

namespace Besture.Dal
{
    public partial class ImageDal : BaseDataAccess
    {
        /// <summary>
        /// 根据ID和图片类型获取图片数据
        /// </summary>
        /// <param name="id"></param>
        /// <param name="imageType"></param>
        /// <returns></returns>
        public DataTable GetDataTableByImageType(int id,int imageType)
        {
            try
            {
                StringBuilder selectSql = new StringBuilder();
                selectSql.Append(string.Format(@"
                SELECT * FROM dbo.TBImage
                WHERE 
                HotelsID={0} 
                AND ImageType={1}
                ORDER BY CreateTime DESC ",id,imageType));
                DbCommand ldcDBCommand = base.GetCommand(selectSql.ToString());
                DataTable dt = base.GetDataSet(ldcDBCommand).Tables[0];
                return dt;
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
    }
}

